using MicroMsg.UI.Page;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class panelTitle2Line : UserControl
	{
		public static DependencyProperty strTitleProperty = DependencyProperty.Register("strTitle", typeof(string), typeof(panelTitle2Line), new PropertyMetadata(null, new PropertyChangedCallback(panelTitle2Line.strTitlePropertyChanged)));
		public static DependencyProperty strSecondTitleProperty = DependencyProperty.Register("strSecondTitle", typeof(string), typeof(panelTitle2Line), new PropertyMetadata(null, new PropertyChangedCallback(panelTitle2Line.strSecondTitlePropertyChanged)));
		public static DependencyProperty ifOneLineTitleProperty = DependencyProperty.Register("ifOneLineTitle", typeof(bool), typeof(panelTitle2Line), new PropertyMetadata(false, new PropertyChangedCallback(panelTitle2Line.ifOneLineTitlePropertyChanged)));
		public static DependencyProperty bIsNeedChangeCaseProperty = DependencyProperty.Register("bIsNeedChangeCase", typeof(bool), typeof(panelTitle2Line), new PropertyMetadata(true, new PropertyChangedCallback(panelTitle2Line.bIsNeedChangeCaseChanged)));
		private MMThemeTypes mPageTheme;
		internal Grid LayoutRoot;
		internal StackPanel TitlePanel;
		internal panelTitleControl panel1Line;
		internal DynamicTextBlock txtPageTitle;
		private bool _contentLoaded;
		public string strTitle
		{
			get
			{
				return (string)base.GetValue(panelTitle2Line.strTitleProperty);
			}
			set
			{
				base.SetValue(panelTitle2Line.strTitleProperty, value);
			}
		}
		public string strSecondTitle
		{
			get
			{
				return (string)base.GetValue(panelTitle2Line.strSecondTitleProperty);
			}
			set
			{
				base.SetValue(panelTitle2Line.strSecondTitleProperty, value);
			}
		}
		public bool ifOneLineTitle
		{
			get
			{
				return (bool)base.GetValue(panelTitle2Line.ifOneLineTitleProperty);
			}
			set
			{
				base.SetValue(panelTitle2Line.ifOneLineTitleProperty, value);
			}
		}
		public bool bIsNeedChangeCase
		{
			get
			{
				return (bool)base.GetValue(panelTitle2Line.bIsNeedChangeCaseProperty);
			}
			set
			{
				base.SetValue(panelTitle2Line.bIsNeedChangeCaseProperty, value);
			}
		}
		private static void strTitlePropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == panelTitle2Line.strTitleProperty)
			{
				panelTitle2Line panelTitle2Line = dependencyObject_0 as panelTitle2Line;
				panelTitle2Line.panel1Line.strTitle = panelTitle2Line.strTitle;
			}
		}
		private static void strSecondTitlePropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == panelTitle2Line.strSecondTitleProperty)
			{
				panelTitle2Line panelTitle2Line = dependencyObject_0 as panelTitle2Line;
				if (panelTitle2Line.bIsNeedChangeCase)
				{
					if (panelTitle2Line.strSecondTitle != null)
					{
						panelTitle2Line.txtPageTitle.Text = panelTitle2Line.strSecondTitle.ToLower();
						return;
					}
				}
				else
				{
					if (panelTitle2Line.strSecondTitle != null)
					{
						panelTitle2Line.txtPageTitle.Text = panelTitle2Line.strSecondTitle;
					}
				}
			}
		}
		private static void ifOneLineTitlePropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == panelTitle2Line.ifOneLineTitleProperty)
			{
				panelTitle2Line panelTitle2Line = dependencyObject_0 as panelTitle2Line;
				if (panelTitle2Line.ifOneLineTitle)
				{
					panelTitle2Line.panel1Line.set_Visibility(1);
					panelTitle2Line.txtPageTitle.set_Margin(new Thickness(20.0, 20.0, 0.0, 0.0));
					return;
				}
				panelTitle2Line.panel1Line.set_Visibility(0);
			}
		}
		private static void bIsNeedChangeCaseChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == panelTitle2Line.bIsNeedChangeCaseProperty)
			{
				panelTitle2Line panelTitle2Line = dependencyObject_0 as panelTitle2Line;
				if (panelTitle2Line.strSecondTitle != null)
				{
					if (panelTitle2Line.bIsNeedChangeCase)
					{
						panelTitle2Line.txtPageTitle.Text = panelTitle2Line.strSecondTitle.ToLower();
						return;
					}
					panelTitle2Line.txtPageTitle.Text = panelTitle2Line.strSecondTitle;
				}
			}
		}
		public panelTitle2Line()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.panelTitle2Line_Loaded));
			this.txtPageTitle.set_Foreground(R.theme.COMMON_2EDTITLE_NORMAL_WORD__BRUSH);
			this.mPageTheme = MMTheme.getThemeType();
		}
		private void panelTitle2Line_Loaded(object sender, RoutedEventArgs e)
		{
			if (this.mPageTheme != MMTheme.getThemeType())
			{
				this.txtPageTitle.set_Foreground(R.theme.COMMON_2EDTITLE_NORMAL_WORD__BRUSH);
				this.mPageTheme = MMTheme.getThemeType();
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/CommonUseControl/panelTitle2Line.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.TitlePanel = (StackPanel)base.FindName("TitlePanel");
			this.panel1Line = (panelTitleControl)base.FindName("panel1Line");
			this.txtPageTitle = (DynamicTextBlock)base.FindName("txtPageTitle");
		}
	}
}
